package com.cw.exception.callback.enums;

import java.util.Arrays;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 异常
 *
 * @author cw
 */
@Getter
@AllArgsConstructor
public enum EnumExceptionErrorCode {
    /** http */
    HTTP("http", "http回调"),
    /** cloud */
    CLOUD("cloud", "cloud接口回调"),
    /** dubbo */
    DUBBO("dubbo", "dubbo接口回调");

    /** 编码 */
    private String code;
    /** 描述 */
    private String description;

    public static EnumExceptionErrorCode find(String code) {
        return Arrays.stream(EnumExceptionErrorCode.values())
            .filter(input -> input.getCode()
                .equals(code))
            .findFirst()
            .orElse(null);
    }
}
